package LC34;

import java.util.HashSet;

public class LC3375 {
    public static void main(String[] args) {

    }

    public int minOperations(int[] nums, int k) {
        HashSet<Integer> set = new HashSet<>();
        int num = 0;
        for (int i = 0; i < nums.length; i++) {
            if (nums[i] > k) {
                set.add(nums[i]);
            } else if (nums[i] < k) {
                return -1;
            } else {
                num++;
            }
        }
        if (num == nums.length) {
            return 0;
        }

        if (set.isEmpty()) {
            return -1;
        }
        return set.size();
    }
}
